<template>
  <el-dialog v-model="dialogVisible" title="Tips" :width="width" :before-close="handleClose">
    <slot />
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="close">关闭</el-button>
        <el-button type="primary" @click="confirm">
          确定修改
        </el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
const props = defineProps<{
  show: boolean,
  width: string
}>()
const emits = defineEmits<{
  (e: 'submit'): void
  (e: 'Close'): void
  (e: 'handleClose'): void
}>();


const confirm = () => {
  emits('submit')
}
const close = () => {
  emits('Close')
}

const handleClose = () => {
  emits('handleClose')
}

const dialogVisible = ref(props.show)


watch(() => props.show, (newvalue) => {
  dialogVisible.value = newvalue
})
</script>

<style></style>